﻿using System;
using System.IO;
using System.Reflection;

namespace CodeRazor
{
    public static class HelperExtensions
    {
        public static string GetAssemblyDirectoryPath(this Type type)
        {
            return GetAssemblyDirectoryPath(type.Assembly);
        }

        public static string GetAssemblyDirectoryPath(this Assembly assembly)
        {
            return Path.GetDirectoryName(GetAssemblyPath(assembly));
        }

        public static string GetAssemblyPath(this Type type)
        {
            return GetAssemblyPath(type.Assembly);
        }

        public static string GetAssemblyPath(this Assembly assembly)
        {
            return new Uri(assembly.CodeBase).LocalPath;
        }
    }
}
